# coding:utf-8
from testconfig import config
from util.requestUtil import sendGetRequest
from util.requestUtil import sendPostRequest

def getUserInfo(tTpye, expectCode):

    host = "http://api2.fenqifu.com.cn"
    path = "/order2/user/userStatus"
    userId = '57abde91b74e755973a736ef'
    parmas = {'userId': userId}
    url = host + path
    headers = {"User-Agent": "Chrome"}
    response = sendGetRequest(url, headers=headers, params=parmas)
    target = response[tTpye]
    # 断言期望值
    assert target == expectCode,u'target: {}, not equal to expectCode: {}'.format(target, expectCode)


def postUserInfo(tType, expectCode):

    host = config['host']
    path = config['path_getuserinfo']
    userId = '57abde91b74e755973a736ef'
    data = {'userId': userId}
    url = host + path
    headers = config['post_headers']
    response = sendPostRequest(url, headers=headers, data=data)
    result = response[tType]
    assert result == expectCode, u'result:{}, not equal to expectCode: {}'.format(result, expectCode)



